package com.symbio.ishenapi.doctor.controller;

import com.jfinal.plugin.activerecord.Record;
import com.symbio.ishenapi.common.controller.BaseController;
import com.symbio.ishenapi.doctor.model.TmDoctorDictionary;
import io.jboot.web.controller.annotation.RequestMapping;

import java.util.List;

/**
 * @Author: chen
 * @Description:医生字典类控制层
 * @Date: Created in 16:24 2018/10/31
 * @Modified By:
 */
@RequestMapping("TmDoctorDictionary")
public class TmDoctorDictionaryController extends BaseController{

    /**
     * 获取医生的字典类型
     */
    public void findByType(){
        String type = getPara("type");
        try {
            List<Record> data = TmDoctorDictionary.dao.findByType(type);
            renderJson(data);
        }catch (Exception e){
            renderJsonError(40005,"字典查询出错");
        }
    }


    /**
     * 获取品牌室类型
     */
    public void findByMaterials(){
        try {
            List<TmDoctorDictionary> data = TmDoctorDictionary.dao.findByMaterials();
            renderJson(data);
        }catch (Exception e){
            renderJsonError(40005,"字典查询出错");
        }
    }

    /**
     *
     * 资料类型
     */
    public void findByData(){
        try {
            List<TmDoctorDictionary> data = TmDoctorDictionary.dao.findByData();
            renderJson(data);
        }catch (Exception e){
            renderJsonError(40005,"字典查询出错");
        }
    }

    /**
     * author:chen
     * 根据code值查询此条信息的详细数据
     * param:  code    服务的code值
     */
    public void findInfoByCode(){
        try {
            String code = getPara("code");
            TmDoctorDictionary dictionary = TmDoctorDictionary.dao.findInfoByCode(code);
            renderJsonRet(dictionary);
        }catch (Exception e){
            renderJsonError(50002,"字典详细查询失败");
        }
    }
}
